home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_051 / sq.usq / sqdebug.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  753b  |  39 lines

  1. /* Debugging aids for SQ and related modules */
  2.  
  3. #include <stdio.h>
  4. #include "sqcom.h"
  5. #include "sq.h"
  6.  
  7. pcounts()
  8. {
  9.     int i;
  10.  
  11.     if(debug) {
  12.         printf("\nCounts after 1st algorithm and maybe scaling");
  13.         for(i = 0; i < NUMVALS; ++i) {
  14.             if(i%8 == 0)
  15.                 printf("\n%4x  ", i);
  16.             printf("%5u  ", node[i].weight);
  17.         }
  18.     printf("\n\n");
  19.     }
  20. }
  21.  
  22. phuff()
  23. {
  24.     int i;
  25.  
  26.     if(debug) {
  27.         printf("\nEncoding tree - root=%3d\n", dctreehd);
  28.         for(i = 0; i < NUMNODES; ++i)
  29.             if(node[i].weight != 0)
  30.                 printf("%3d  w=%5u d=%3d l=%3d r=%3d\n", i, node[i].weight, node[i].tdepth, node[i].lchild, node[i].rchild);
  31.  
  32.         printf("\nHuffman codes\n");
  33.         for(i = 0; i < NUMVALS; ++i) {
  34.             if(codelen[i] > 0)
  35.                 printf("%3d  %4x l=%2d c=%4x\n", i, i, codelen[i], code[i]);
  36.         }
  37.     }
  38. }
  39.